home *** CD-ROM | disk | FTP | other *** search
- Path: in1.uu.net!interaccess!usenet
- From: brianmcg@interaccess.com (Brian V. McGroarty)
- Newsgroups: comp.lang.c
- Subject: Re: Could someone help me with this imbedded assembly code
- Date: 19 Mar 1996 01:59:42 GMT
- Organization: Internet Squire
- Message-ID: <4il4ee$m77@nntp.interaccess.com>
- References: <4ikm39$g8b@host-3.cyberhighway.net>
- Reply-To: brianmcg@interaccess.com
- NNTP-Posting-Host: d48-isdn.nhe.interaccess.com
- X-Newsreader: Internet Squire 1.20
-
- I believe that you're going to need to pull the labels out of the assembly
- section and explicitly return the contents of ax. The modified function
- would read:
-
- unsigned char scankey(void)
- {
- unsigned char keyFound;
-
- asm {
- mov ah, 01h
- int 16h
- jz empty;
- mov ah, 00h
- int 16h
- mov al, keyFound
- }
- empty:
- return( keyFound );
- }
-
-
-
- lassiter wrote:
- >#include <iostream.h>
- >
- >unsigned char scankey(void)
- >{
- > asm{
- > mov ah, 01h
- > int 16h
- > jz empty;
- > mov ah, 00h
- > int 16h
- > mov al, ah
- > xor ah, ah
- > jmp done;
- > empty:
- > xor ax, ax
- > done:
- > }
- > }
- >
- > Could someone tell me what is wrong with this code? I am using Borland
- > C++ 3.0. The errors I am getting are
- >
- > error test.cpp 19: undefined label 'done'
- > error test.cpp 19: undefined label 'empty'
- > warning test.cpp 19: Function should return a value
-
-
-
- ---
- Brian Valters McGroarty -- brianmcg@bix.com
- phone/fax (847) 439-7714
-